<?php namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\Goods
 *
 * @property integer $id 自增id
 * @property string $ssn 商品货号
 * @property string $name 商品名称
 * @property float $m_price 市场价格
 * @property float $s_price 销售价格
 * @property integer $thumb_id 商品缩略图
 * @property string $info 商品信息描述
 * @property integer $stock 商品库存
 * @property integer $type_id 商品大分类id
 * @property integer $isshop 是否上架，0：否 1：是
 * @property string $shoptime 上架时间
 * @property integer $isrecommend 是否推荐，0：否 1：是
 * @property integer $sale_count 销售数量
 * @property integer $isnew 是否新品，0：否 1：是
 * @property integer $sort 商品排序，整数，数字越低排序越前
 * @property integer $user_id 发布者
 * @property string $deleted_at
 * @property \Carbon\Carbon $created_at
 * @property \Carbon\Carbon $updated_at
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereSsn($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereName($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereMPrice($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereSPrice($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereThumbId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereInfo($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereStock($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereTypeId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereIsshop($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereShoptime($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereIsrecommend($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereSaleCount($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereIsnew($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereSort($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereUserId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereDeletedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereCreatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereUpdatedAt($value)
 * @mixin \Eloquent
 * @property-read \App\User $user
 * @property string $link 外链
 * @property float $express_fee 快递费用
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereLink($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Goods whereExpressFee($value)
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\OrderItem[] $orderItem
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\GoodsImg[] $goodImgs
 * @method static bool|null forceDelete()
 * @method static \Illuminate\Database\Query\Builder|\App\Goods onlyTrashed()
 * @method static bool|null restore()
 * @method static \Illuminate\Database\Query\Builder|\App\Goods withTrashed()
 * @method static \Illuminate\Database\Query\Builder|\App\Goods withoutTrashed()
 * @property int $is_custom 是否定制商品
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Goods whereIsCustom($value)
 */
class Goods extends Model
{
    protected $table = 'goods';
    use SoftDeletes;

    public function user(){
        return $this->belongsTo('App\User','user_id');
    }

    public function goodImgs(){
        return $this->hasMany('App\GoodsImg','good_id');
    }
}